package cn.shuibo.advice;

/**
 * @author hz21097238 白小纯-陈煜
 * @date 2022/1/20 23:13
 * @description 传递appid变量
 */
public class AdviceLocalThread {
    private static ThreadLocal<AppIdDto> encryptLocalAppid = new ThreadLocal<>();
    public static void setAppid(AppIdDto appid){
        encryptLocalAppid.set(appid);
    }

    public static String getHomeAppid(){
        AppIdDto appIdDto = encryptLocalAppid.get();
        return appIdDto!=null ? appIdDto.getHome() : null;
    }

    public static String getSenderAppid(){
        AppIdDto appIdDto = encryptLocalAppid.get();
        return appIdDto!=null ? appIdDto.getSender() : null;
    }

    public static class AppIdDto{
        String home;
        String sender;

        public AppIdDto(String home, String sender) {
            this.home = home;
            this.sender = sender;
        }

        public AppIdDto() {
        }

        public String getHome() {
            return home;
        }

        public void setHome(String home) {
            this.home = home;
        }

        public String getSender() {
            return sender;
        }

        public void setSender(String sender) {
            this.sender = sender;
        }
    }
}
